<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.foxcai.novel.base.DBConnection"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="com.foxcai.novel.html.JspContextServices"%>
<%
	JspContextServices utb = new JspContextServices();
	utb.initialize(request, response);
	int pages = 1;
	String keys = "";
	int totleNum;
	int showNum = 30;
	try{
		pages = Integer.parseInt(request.getParameter("page"));
	}catch(Exception e){
		pages = 1;
	}
	if (request.getParameter("wd") != null
			&& !request.getParameter("wd").equals("")) {
		keys = request.getParameter("wd").trim();
	}
	try{
		ResultSet rs = null;
		DBConnection conn = DBConnection.newInstance();
		String sql = "select NovId,category,novel,author,NovAcc,comm,UpdTime from novellist where novel like '%"
				+ keys
				+ "%' or author like '%"
				+ keys
				+ "%' order by NovAcc desc limit "
				+ (pages - 1)
				* showNum
				+ ","+showNum+"";
		String totSql = "select count(NovId) from novellist where novel like '%"
			+ keys
			+ "%' or author like '%"
			+ keys
			+ "%' order by NovAcc desc";
		totleNum = conn.queryTotle(totSql);
		rs = conn.executeQuery(sql);
	}catch(Exception e){
		//String newLocn = "/Error.jsp";  
		//response.setHeader("Location",newLocn);
		response.sendRedirect("/Error.jsp");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>小说排行榜-SoDu小说搜索-最好的小说搜索网站</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="玄幻小说 小说搜索 搜读 搜度 搜索阅读网 小说阅读网 最新章节" />
		<meta http-equiv="description" content="SoDu专注于玄幻小说搜索，方便大家舒服愉快地查找阅读玄幻小说" />
		<link rel="stylesheet" type="text/css" href="styles/css.css" />
	</head>
	<body>
		<div id="container">
			<div id="header">
				<div class="logo">
					<a href="#"><img src="images/sodu1.jpg" height="60" /></a>
				</div>
				<div class="search">
					<form id="gogo" method="get" action="#">
						<input type="text" name="wd" class="inp" value="<%=keys%>" />
						<input type="submit" value="SoDu小说搜索" class="but" />
					</form>
				</div>
			</div>
			<div id="path">
				<span class="fl"><a href="#">SoDu</a>&nbsp;>&nbsp;小说排行 </span>
				<span class="fr"><a href="index.jsp">点击排行</a>&nbsp;|&nbsp;<a href="last.jsp">最新更新</a>
				</span>
			</div>
			<div class="advs">
				<font color=blue>SoDu</font>提供
				<b>小说排行榜</b>供大家选择最好看的小说<br>
					SoDu访问量大，不涉及其它利益，榜单公正。 <br>
					记住本站站名： <font color=blue>SoDu</font>；域名：sodu.org，查看小说更方便。 
			</div>
			<div id="main">
				<div class="contentlist">
					<dl class="cl">
						<dt>
							<span class="m1"><b>排行小说名</b> </span>
							<span class="m2">作者</span>
							<span class="m3">分类</span>
							<span class="m4">阅读量</span>
							<span class="m5">更新时间</span>
						</dt>
						<% while (rs.next()) { %>
						<dd>
							<span class="m1"><a href="view.jsp?nid=<%=rs.getString("NovId")%>" target="_blank"><%=rs.getString("novel")%></a>
							</span>
							<span class="m2"><%=rs.getString("author")%></span>
							<span class="m3"><%=rs.getString("category")%></span>
							<span class="m4"><%=rs.getInt("NovAcc")%></span>
							<span class="m5"><%=rs.getString("UpdTime").substring(0, 10)%></span>
						</dd>
						<% } conn.close(); %>
					</dl>
				</div>
				<div class="page">
					<%=utb.getTrunPageHtm(totleNum, showNum)%>
				</div>
			</div>
			<div id="footer">
				<p align=center>
					本站是一个小说搜索引擎，提供且仅提供各小说论坛以及书库的最新小说链接。<br />
					倘若您认为本站的链接侵犯了您的版权，请将有效文件扫描发送给SoDu。 <br />
					SoDu将在第一时间将该链接删除。 
				</p>
			</div>
		</div>
	</body>
</html>
